import React, { Component } from 'react'
import CourseItem from './CourseItem';

const courseList = [12];

export default class CourseList extends Component {
    state = {
        courseData: [
            {name: 'Nodejs', task: 2, stu: 20, id:'001'},
            {name: 'Winxin', task: 0, stu: 25, id:'002'},
            {name: '移动web', task: 2, stu: 13, id:'003'},
            {name: 'Java', task: 5, stu: 35, id:'004'},
            {name: '测试', task: 3, stu: 26, id:'005'},
            {name: '移动web', task: 2, stu: 13, id:'006'},
            {name: 'Java', task: 5, stu: 35, id:'007'},
            {name: '测试', task: 3, stu: 26, id:'008'},
        ]
    }
    render() {
        const {courseData} = this.state;
        console.log(courseData);
        return (
            <div style = {{display:"flex",justifyContent:"space-between",flexWrap:"wrap"}}>
                {
                    //普通传
                    courseData.map((item)=><CourseItem stu={item.stu} task={item.task} key={item.id}/>)
                    
                    //批量传
                    // courseData.map((item)=><CourseItem {...item} key={item.id}/>)

                    //以对象形式传
                    // courseData.map((item)=><CourseItem data={item} key={item.id}/>)
                }
                {/* {
                    courseData.map((item,index)=>{//如果不写return就不要在箭头后加大括号
                        return(
                            <div>{item.name}</div>
                        )
                    })
                } */}
                
                {/* <CourseItem /> */}
            </div>
        )
    }
}
